package com.platform.enums.formatters;

import com.platform.enums.CommFlagType;
import org.springframework.format.Formatter;
import org.springframework.lang.NonNull;

import java.util.Locale;

/**
 * 功能描述: 前端字符串转CommFlagType枚举
 *
 * @author coder create on 2018-03-17-10:29
 */
public class CommFlagTypeFormatter implements Formatter<CommFlagType> {

    @Override
    @NonNull
    public CommFlagType parse(@NonNull String text, @NonNull Locale locale) {
        return CommFlagType.getFlagByValue(text);
    }

    @Override
    @NonNull
    public String print(@NonNull CommFlagType flagType, @NonNull Locale locale) {
        return flagType.getFvalue();
    }
}
